import type * as T from './type'
import http from '@/utils/http'
import type {SubjectDto} from "./type";

const BASE_URL = '/system/subject'
/** @desc 查询題目列表 */
export function listSubject(query: T.SubjectQuery) {
  return http.post<PageRes<T.SubjectPageQuery[]>>(`${BASE_URL}/page`, query)
}
export function recyclePages(query: T.SubjectQuery) {
  return http.get<PageRes<T.SubjectPageQuery[]>>(`${BASE_URL}/recyclePage`, query)
}

/** @desc 根據單元編號查询題目集合 */
export function getByUnitIdSubjects(query: any) {
  return http.get<SubjectDto[]>(`${BASE_URL}/list`,query)
}


/** @desc 查询題目详情 */
export function getSubject(id: string) {
  return http.get<T.SubjectDto>(`${BASE_URL}/getData/${id}`)
}


export function getPinYin(name: string) {
  return http.get<T.SubjectDto>(`${BASE_URL}/pinYin/${name}`)
}



/** @desc 新增題目 */
export function addSubject(data: any) {
  return http.post(`${BASE_URL}/create`, data)
}

/** @desc 修改題目 */
export function updateSubject(data: any) {
  return http.post(`${BASE_URL}/modify`, data)
}

/** @desc 逻辑删除題目 */
export function logicDeleteSubject(ids: string | Array<string>) {
  return http.del(`${BASE_URL}/logicDelete/${ids}`)
}

/** @desc 删除題目 */
export function deleteSubject(ids: string | Array<string>) {
  return http.del(`${BASE_URL}/delete/${ids}`)
}


